<?
	session_start();
	ob_start();
	//global $TRDF;
	if(empty($_SESSION['user_login'])){
		echo"
		<br><br><br><br><br>
		<div align=center style='font-family: verdana; font-size: 10px; color: red;'>
		 Maaf, Halaman ini tidak bisa diakses. <br>
		 <a href='../index.php'>Anda harus login terlebih dahulu.</a><br><br><BR>
		 <span style='color:black;'>Aplikasi SDM, PT.Surveyor Indonesia</span>
		</div>
		";
		exit();
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Statistik Kepegawaian PT. Surveyor Indonesia</title>
<link rel="stylesheet" type="text/css" href="../style/print.css" media="print" />
<style type="text/css">
 body,table{
 	font-family:Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
 }
</style>
</head>
<body>
<?
	if($HTTP_GET_VARS['excel'] == "yes"){}
	else{
?>
<div style="color:blue;" class="print_ignore">
[ <a href="Javascript:window.print();" style="text-decoration:none;">CETAK</a> | <a href="<?=$PHP_SELF?>?excel=yes" style="text-decoration:none;">Export to Excel</a> ]
</div>
<?
	}
?>
<center><span style="font-size:16px;"><b>STATISTIK KEPEGAWAIAN PT. SURVEYOR INDONESIA</b></span></center>
<center>(<?=date("F Y")?>)</center><br />
<?
	include("../lib/config.php");
?>
<table border="1" width="100%">
 <tr>
  <td rowspan="2" width="250" align="center"><b>URAIAN</b></td>
  <td rowspan="2" align="center" width="50"><b>TOTAL</b></td>
  <td colspan="5" align="center"><b>STATUS KEPEGAWAIAN</b></td>
 </tr>
 <tr>
  <td width="100" align="center" bgcolor="#999999" style="color:#FFFFFF;"><b>Jumlah Pegawai</b></td>
  <td width="100" align="center"><b>Tetap</b></td>
  <td width="100" align="center"><b>Percobaan</b></td>
  <td width="100" align="center"><b>PKUWT</b></td>
  <td width="100" align="center"><b>Kontrak Lembaga</b></td>
 </tr>
 <tr bgcolor="#CCCCCC">
  <td><b>KANTOR PUSAT (SIHO)</b></td>
  <td></td>
  <td align="center">A + B + C</td>
  <td align="center">A</td>
  <td align="center">B</td>
  <td align="center">C</td>
  <td align="center">D</td>
 </tr>
 <tr>
  <td><b>Direktorat Utama</b></td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
 </tr>
 <tr>
   	<?
    	// get jumlah pegawai tetap dalam divisi manajemen strategi, kode so: 010004800000, tetap: 1
		$sdms1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010004800000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
		$tdms1	= mssql_fetch_row($sdms1);
		//echo"$tdms1[0]";
    	// get jumlah pegawai percobaan dalam divisi manajemen strategi, kode so: 010004800000, tetap: 2
		$sdms2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010004800000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
		$tdms2	= mssql_fetch_row($sdms2);
		//echo"$tdms2[0]";
    	// get jumlah pegawai pkuwt dalam divisi manajemen strategi, kode so: 010004800000, tetap: 5
		$sdms3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010004800000',0,7)."' AND (stat_kar2='5') AND Jenis NOT IN ('U','H')",$conn);
		$tdms3	= mssql_fetch_row($sdms3);
		//echo"$tdms3[0]";
	?>
  <td>1. D M S</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	// jumlah A + C
	//echo ($tdms1[0] + $tdms2[0]);
	$SDMS = ($tdms1[0] + $tdms2[0] + $tdms3[0]);
	echo"$SDMS";
  ?>
  </td>
  <td align="right"> 
    <?=$tdms1[0]?>
  </td>
  <td align="right">
   	<?=$tdms2[0]?>
  </td>
  <td align="right">
   	<?=$tdms3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
    	// get jumlah pegawai tetap dalam sekretaris perusahaan, kode so: 010004300000, tetap: 1
		$ssp1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010004300000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
		$tsp1	= mssql_fetch_row($ssp1);
		//echo"$tsp1[0]";
    	// get jumlah pegawai percobaan dalam sekretaris perusahaan, kode so: 010004300000, tetap: 2
		$ssp2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010004300000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
		$tsp2	= mssql_fetch_row($ssp2);
		//echo"$tsp2[0]";
    	// get jumlah pegawai pkuwt dalam sekretaris perusahaan, kode so: 010004300000, tetap: 5
		$ssp3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010004300000',0,7)."' AND (stat_kar2='5') AND Jenis NOT IN ('U','H')",$conn);
		$tsp3	= mssql_fetch_row($ssp3);
		//echo"$tsp3[0]";
 ?>
  <td>2. S P</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	// jumlah A + C
	//echo ($tsp1[0] + $tsp2[0]);
	$SSP = ($tsp1[0] + $tsp2[0] + $tsp3[0]);
	echo"$SSP";
  ?>
  </td>
  <td align="right"> 
   	<?=$tsp1[0]?>
  </td>
  <td align="right">
   	<?=$tsp2[0]?>
  </td>
  <td align="right">
   	<?=$tsp3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
    	// get jumlah pegawai tetap dalam satuan pengawas intern, kode so: 010004400000, tetap: 1
		$sspi1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010004400000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
		$tspi1	= mssql_fetch_row($sspi1);
		// echo"$tspi1[0]";
    	// get jumlah pegawai percobaan dalam satuan pengawas intern, kode so: 010004400000, tetap: 2
		$sspi2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010004400000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
		$tspi2	= mssql_fetch_row($sspi2);
		// echo"$tspi2[0]";
    	// get jumlah pegawai pkuwt dalam satuan pengawas intern, kode so: 010004400000, tetap: 5
		$sspi3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010004400000',0,7)."' AND (stat_kar2='5') AND Jenis NOT IN ('U','H')",$conn);
		$tspi3	= mssql_fetch_row($sspi3);
		//echo"$tspi3[0]";
 ?>
  <td>3. S P I</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	// jumlah A + C
	//echo ($tspi1[0] + $tspi2[0]);
	$SSPI = ($tspi1[0] + $tspi2[0] + $tspi3[0]);
	echo $SSPI;
  ?>
  </td>
  <td align="right"> 
   	<?=$tspi1[0]?>
  </td>
  <td align="right">
   	<?=$tspi2[0]?>
  </td>
  <td align="right">
   	<?=$tspi3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
    	// get jumlah pegawai tetap dalam unit managemen resiko, kode so: 010004900000, tetap: 1
		$sumr1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010004900000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
		$tumr1	= mssql_fetch_row($sumr1);
		//echo"$tumr1[0]";
    	// get jumlah pegawai percobaan dalam unit managemen resiko, kode so: 010004900000, tetap: 2
		$sumr2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010004900000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
		$tumr2	= mssql_fetch_row($sumr2);
		//echo"$tumr2[0]";
    	// get jumlah pegawai pkuwt dalam unit managemen resiko, kode so: 010004900000, tetap: 5
		$sumr3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010004900000',0,7)."' AND (stat_kar2='5') AND Jenis NOT IN ('U','H')",$conn);
		$tumr3	= mssql_fetch_row($sumr3);
		//echo"$tumr3[0]";
 ?>
  <td>4. UNIT MR</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	// jumlah A + C
	//echo ($tumr1[0] + $tumr2[0]);
	$STUMR = ($tumr1[0] + $tumr2[0] + $tumr3[0]);
	echo"$STUMR";
  ?>
  </td>
  <td align="right"> 
   	<?=$tumr1[0]?>
  </td>
  <td align="right">
   	<?=$tumr2[0]?>
  </td>
  <td align="right">
   	<?=$tumr3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
  <td align="center"><b><i>Sub Total</i></b></td>
  <td>&nbsp;</td>
  <td align="right">
  <b>
  <?
  	// subtotal jumlah pegawai (A+C)
	echo ($SDMS+$SSP+$SSPI+$STUMR);
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
  	// total peg tetap kantor pusat
	echo ($tdms1[0]+$tsp1[0]+$tspi1[0]+$tumr1[0]);
  ?>
  </b>
  </td>
  <td align="right"><b>
  <?
  	// total peg percobaan kantor pusat
	echo ($tdms2[0]+$tsp2[0]+$tspi2[0]+$tumr2[0]);
  ?>
  </b></td>
  <td align="right">
  <b>
  <?
  	// total peg pkuwt kantor pusat
	echo ($tdms3[0]+$tsp3[0]+$tspi3[0]+$tumr3[0]);
  ?>
  </b>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
 </tr>
 <tr>
  <td><b>Direktorat Keuangan & Administrasi</b></td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
	// get jumlah pegawai tetap dalam divisi keuangan dan akuntansi, kode so: 030001900000, tetap: 1
	$sdka1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('030001900000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
	$tdka1	= mssql_fetch_row($sdka1);
	//echo"$tdka1[0]";
	// get jumlah pegawai percobaan dalam divisi keuangan dan akuntansi, kode so: 030001900000, tetap: 2
	$sdka2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('030001900000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
	$tdka2	= mssql_fetch_row($sdka2);
	//echo"$tdka2[0]";
	// get jumlah pegawai pkuwt dalam divisi keuangan dan akuntansi, kode so: 030001900000, tetap: 5
	$sdka3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('030001900000',0,7)."' AND (stat_kar2='5') AND Jenis NOT IN ('U','H')",$conn);
	$tdka3	= mssql_fetch_row($sdka3);
	//echo"$tdka3[0]";
 ?>
  <td>1. D K A</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	// jumlah A + C
	//echo ($tumr1[0] + $tumr2[0]);
	$SDKA = ($tdka1[0] + $tdka2[0] + $tdka3[0]);
	echo"$SDKA";
  ?>
  </td>
  <td align="right"> 
   	<?=$tdka1[0]?>
  </td>
  <td align="right">
   	<?=$tdka2[0]?>
  </td>
  <td align="right">
   	<?=$tdka3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
	// get jumlah pegawai tetap dalam divisi sumber daya manusia, kode so: 030001800000, tetap: 1
	$ssdm1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('030001800000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
	$tsdm1	= mssql_fetch_row($ssdm1);
	//echo"$tsdm1[0]";

	// get jumlah pegawai percobaan dalam divisi sumber daya manusia, kode so: 030001800000, tetap: 2
	$ssdm2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('030001800000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
	$tsdm2	= mssql_fetch_row($ssdm2);
	//echo"$tsdm2[0]";

	// get jumlah pegawai pkuwt dalam divisi sumber daya manusia, kode so: 030001800000, tetap: 5
	$ssdm3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('030001800000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H') ",$conn);
	$tsdm3	= mssql_fetch_row($ssdm3);
	//echo"$tsdm3[0]";
 ?>
  <td>2. D S D M</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	// jumlah A + C
	//echo ($tumr1[0] + $tumr2[0]);
	$SDSDM = ($tsdm1[0] + $tsdm2[0] + $tsdm3[0]);
	echo"$SDSDM";
  ?>
  </td>
  <td align="right"> 
   	<?=$tsdm1[0]?>
  </td>
  <td align="right">
   	<?=$tsdm2[0]?>
  </td>
  <td align="right">
   	<?=$tsdm3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
	// get jumlah pegawai tetap dalam divisi manajemen fasilitas, kode so: 030001600000, tetap: 1
	$sdmf1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('030001600000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
	$tdmf1	= mssql_fetch_row($sdmf1);
	//echo"$tdmf1[0]";
	// get jumlah pegawai percobaan dalam divisi manajemen fasilitas, kode so: 030001600000, tetap: 2
	$sdmf2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('030001600000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
	$tdmf2	= mssql_fetch_row($sdmf2);
	//echo"$tdmf2[0]";
	// get jumlah pegawai pkuwt dalam divisi manajemen fasilitas, kode so: 030001600000, tetap: 5
	$sdmf3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('030001600000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
	$tdmf3	= mssql_fetch_row($sdmf3);
	//echo"$tdmf3[0]";
 ?>
  <td>3. DIV. MAN. FASILITAS</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	$SDMF = ($tdmf1[0]+$tdmf2[0]+$tdmf3[0]);
	echo $SDMF;
  ?>
  </td>
  <td align="right"> 
   	<?=$tdmf1[0]?>
  </td>
  <td align="right">
   	<?=$tdmf2[0]?>
  </td>
  <td align="right">
   	<?=$tdmf3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
	// get jumlah pegawai tetap dalam unit pkbl, kode so: 030001500000, tetap: 1
	//$spkbl1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE (substring(kode_so1,1,7)='".substr('030001500000',0,7)."' OR substring(kode_so2,1,7)='".substr('030001600000',0,7)."') AND (stat_kar2='1')",$conn);
	$spkbl1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('030001500000',0,7)."' AND stat_kar2='1' AND Jenis NOT IN ('U','H')",$conn);
	$tpkbl1	= mssql_fetch_row($spkbl1);
	//echo"$tpkbl1[0]";

	// get jumlah pegawai percobaan dalam unit pkbl, kode so: 030001500000, tetap: 2
	//$spkbl2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE (substring(kode_so1,1,7)='".substr('030001500000',0,7)."' OR substring(kode_so2,1,7)='".substr('030001600000',0,7)."') AND (stat_kar2='2')",$conn);
	$spkbl2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('030001500000',0,7)."' AND stat_kar2='2' AND Jenis NOT IN ('U','H')",$conn);
	$tpkbl2	= mssql_fetch_row($spkbl2);
	//echo"$tpkbl2[0]";

	// get jumlah pegawai pkuwt dalam unit pkbl, kode so: 030001500000, tetap: 5
	//$spkbl3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE (substring(kode_so1,1,7)='".substr('030001500000',0,7)."' OR substring(kode_so2,1,7)='".substr('030001600000',0,7)."') AND stat_kar2='5')",$conn);
	$spkbl3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('030001500000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
	$tpkbl3	= mssql_fetch_row($spkbl3);
	//echo"$tpkbl3[0]";
 ?>
  <td>4. UNIT PKBL</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	$SPKBL = ($tpkbl1[0]+$tpkbl2[0]+$tpkbl3[0]);
	echo $SPKBL;
  ?>
  </td>
  <td align="right"> 
   	<?=$tpkbl1[0]?>
  </td>
  <td align="right">
   	<?=$tpkbl2[0]?>
  </td>
  <td align="right">
   	<?=$tpkbl3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
    	// get jumlah pegawai tetap dalam unit teknologi informasi, kode so: 010004700000, tetap: 1
		$suti1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010004700000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
		$tuti1	= mssql_fetch_row($suti1);
		//echo"$tuti1[0]";

    	// get jumlah pegawai percobaan dalam unit teknologi informasi, kode so: 010004700000, tetap: 2
		$suti2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010004700000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
		$tuti2	= mssql_fetch_row($suti2);
		//echo"$tuti2[0]";

    	// get jumlah pegawai pkuwt dalam unit teknologi informasi, kode so: 010004700000, tetap: 5
		$suti3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010004700000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
		$tuti3	= mssql_fetch_row($suti3);
		//echo"$tuti3[0]";
 ?>
  <td>5. UNIT IT</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	$SUIT = ($tuti1[0]+$tuti2[0]+$tuti3[0]);
	echo $SUIT;
  ?>
  </td>
  <td align="right"> 
   	<?=$tuti1[0]?>
  </td>
  <td align="right">
   	<?=$tuti2[0]?>
  </td>
  <td align="right">
   	<?=$tuti3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
  <td align="center"><b><i>Sub Total</i></b></td>
  <td>&nbsp;</td>
  <td align="right">
  <b>
  <?
  	// sub total jumlah pegawai di direktorat keuangan dan administrasi
	echo ($SDKA+$SDSDM+$SDMF+$SPKBL+$SUIT);
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
  	// sub total jumlah pegawai teteap di dir keuangan dan administrasi
  	echo ($tdka1[0]+$tsdm1[0]+$tdmf1[0]+$tpkbl1[0]+$tuti1[0]);
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
  	// sub total jumlah pegawai percobaan di dir keuangan dan administrasi
  	echo ($tdka2[0]+$tsdm2[0]+$tdmf2[0]+$tpkbl2[0]+$tuti2[0]);
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
  	// sub total jumlah pegawai percobaan di dir keuangan dan administrasi
  	echo ($tdka3[0]+$tsdm3[0]+$tdmf3[0]+$tpkbl3[0]+$tuti3[0]);
  ?>
  </b>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr bgcolor="#CCCCCC">
  <td><b>TOTAL PEGAWAI KANTOR PUSAT</b></td>
  <td>&nbsp;</td>
  <td align="right">
  <b>
  <?
  	// total pegawai (A+C) kantor pusat
	//echo ($SDKA+$SDSDM+$SDMF+$SPKBL+$SUIT+$SDMS+$SSP+$SSPI+$STUMR);
	$total_pusat = ($SDKA+$SDSDM+$SDMF+$SPKBL+$SUIT+$SDMS+$SSP+$SSPI+$STUMR);
	echo $total_pusat;
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
  	// total pegawai tetap di kantor pusat
  	//echo ($tdka1[0]+$tsdm1[0]+$tdmf1[0]+$tpkbl1[0]+$tuti1[0]+$tdms1[0]+$tsp1[0]+$tspi1[0]+$tumr1[0]);
	$total_pusat_tetap = ($tdka1[0]+$tsdm1[0]+$tdmf1[0]+$tpkbl1[0]+$tuti1[0]+$tdms1[0]+$tsp1[0]+$tspi1[0]+$tumr1[0]);
	echo $total_pusat_tetap;
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
  	// total pegawai percobaan di kantor pusat
  	//echo ($tdka2[0]+$tsdm2[0]+$tdmf2[0]+$tpkbl2[0]+$tuti2[0]+$tdms2[0]+$tsp2[0]+$tspi2[0]+$tumr2[0]);
	$total_pusat_percobaan = ($tdka2[0]+$tsdm2[0]+$tdmf2[0]+$tpkbl2[0]+$tuti2[0]+$tdms2[0]+$tsp2[0]+$tspi2[0]+$tumr2[0]);
	echo $total_pusat_percobaan;
  ?>
  </b> 
  </td>
  <td align="right">
  <b>
  <?
  	// total pegawai pkuwt di kantor pusat
  	//echo ($tdka3[0]+$tsdm3[0]+$tdmf3[0]+$tpkbl3[0]+$tuti3[0]+$tdms3[0]+$tsp3[0]+$tspi3[0]+$tumr3[0]);
	$total_pusat_pkuwt = ($tdka3[0]+$tsdm3[0]+$tdmf3[0]+$tpkbl3[0]+$tuti3[0]+$tdms3[0]+$tsp3[0]+$tspi3[0]+$tumr3[0]);
	echo $total_pusat_pkuwt; 
  ?> 
  </b> 
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
 </tr>
 <tr bgcolor="#CCCCCC">
  <td><b>STRATEGI BISNIS UNIT (SBU)</b></td>
  <td>&nbsp;</td>
  <td align="center">&nbsp;</td>
  <td align="center">&nbsp;</td>
  <td align="center">&nbsp;</td>
  <td align="center">&nbsp;</td>
  <td align="center">&nbsp;</td>
 </tr>
 <tr>
  <td><b>Direktorat Operasi I</b></td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
	// get jumlah pegawai tetap dalam SBU PERTAMBANGAN & ENERGI I, kode so: 050100100000, tetap: 1
	$ssbupe1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('050100100000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
	$tsbupe1	= mssql_fetch_row($ssbupe1);
	//echo"$tsbupe1[0]";
	// get jumlah pegawai percobaan dalam SBU PERTAMBANGAN & ENERGI I, kode so: 050100100000, tetap: 2
	$ssbupe2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('050100100000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
	$tsbupe2	= mssql_fetch_row($ssbupe2);
	//echo"$tsbupe2[0]";
	// get jumlah pegawai pkuwt dalam SBU PERTAMBANGAN & ENERGI I, kode so: 050100100000, tetap: 5
	$ssbupe3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('050100100000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
	$tsbupe3	= mssql_fetch_row($ssbupe3);
	//echo"$tsbupe3[0]";
 ?>
  <td>1. SBU PERTAMBANGAN &amp; ENERGI I</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	// jumlah pegawai (A+C)
	$SSBUPE1 = ($tsbupe1[0]+$tsbupe2[0]+$tsbupe3[0]);
	echo"$SSBUPE1";
  ?>
  </td>
  <td align="right"> 
   	<?=$tsbupe1[0]?>
  </td>
  <td align="right">
   	<?=$tsbupe2[0]?>
  </td>
  <td align="right">
   	<?=$tsbupe3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
    	// get jumlah pegawai tetap dalam SBU PERTAMBANGAN & ENERGI II, kode so: 050100200000, tetap: 1
		$ssbupe21	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('050100200000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
		$tsbupe21	= mssql_fetch_row($ssbupe21);
		//echo"$tsbupe21[0]";
    	// get jumlah pegawai percobaan dalam SBU PERTAMBANGAN & ENERGI II, kode so: 050100200000, tetap: 2
		$ssbupe22	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('050100200000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
		$tsbupe22	= mssql_fetch_row($ssbupe22);
		//echo"$tsbupe2[0]";
    	// get jumlah pegawai pkuwt dalam SBU PERTAMBANGAN & ENERGI II, kode so: 050100200000, tetap: 5
		$ssbupe33	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('050100200000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
		$tsbupe33	= mssql_fetch_row($ssbupe33);
		//echo"$tsbupe3[0]";
 ?>
  <td>2. SBU PERTAMBANGAN &amp; ENERGI II</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	$SSPE2 = ($tsbupe21[0]+$tsbupe22[0]+$tsbupe33[0]);
	echo $SSPE2;
  ?>
  </td>
  <td align="right"> 
   	<?=$tsbupe21[0]?>
  </td>
  <td align="right">
   	<?=$tsbupe22[0]?>
  </td>
  <td align="right">
   	<?=$tsbupe33[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
    	// get jumlah pegawai tetap dalam SBU PEMBERDAYAAN & PENGEMBANGAN INDUSTRI DALAM NEGERI, kode so: 050100300000, tetap: 1
		$sppidn1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('050100300000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
		$tppidn1	= mssql_fetch_row($sppidn1);
		//echo"$tppidn1[0]";
    	// get jumlah pegawai percobaan dalam SBU PEMBERDAYAAN & PENGEMBANGAN INDUSTRI DALAM NEGERI, kode so: 050100300000, tetap: 2
		$sppidn2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('050100300000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
		$tppidn2	= mssql_fetch_row($sppidn2);
		//echo"$tppidn2[0]";
    	// get jumlah pegawai pkuwt dalam SBU PEMBERDAYAAN & PENGEMBANGAN INDUSTRI DALAM NEGERI, kode so: 050100300000, tetap: 5
		$sppidn3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('050100300000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
		$tppidn3	= mssql_fetch_row($sppidn3);
		//echo"$tppidn3[0]";
 ?>
  <td>3. SBU PPIDN</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	$SSPPIDN = ($tppidn1[0]+$tppidn2[0]+$tppidn3[0]);
	echo $SSPPIDN;
  ?>
  </td>
  <td align="right"> 
   	<?=$tppidn1[0]?>
  </td>
  <td align="right">
   	<?=$tppidn2[0]?>
  </td>
  <td align="right">
   	<?=$tppidn3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
  <td align="center"><b><i>Sub Total </i></b></td>
  <td>&nbsp;</td>
  <td align="right"><b>
  <?
  	echo ($SSBUPE1+$SSPE2+$SSPPIDN);
  ?></b>
  </td>
  <td align="right">
  <b>
  <?
	echo ($tsbupe1[0]+$tsbupe21[0]+$tppidn1[0]);
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
	echo ($tsbupe2[0]+$tsbupe22[0]+$tppidn2[0]);
  ?>
  </b>  
  </td>
  <td align="right">
  <b>
  <?
	echo ($tsbupe3[0]+$tsbupe33[0]+$tppidn3[0]);
  ?>
  </b>  
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
  <td colspan="7">&nbsp;</td>
 </tr>
 <tr>
  <td><b>Direktorat Operasi II</b></td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
	// get jumlah pegawai tetap dalam INDUSTRI PERTAMBANGAN & ENERGI I	060100600000, kode so: 060100600000, tetap: 1
	$sIPE1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('060100600000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
	$tIPE1	= mssql_fetch_row($sIPE1);
	//echo"$tIPE1[0]";
	// get jumlah pegawai percobaan dalam INDUSTRI PERTAMBANGAN & ENERGI I	060100600000, kode so: 060100600000, tetap: 2
	$sIPE2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('060100600000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
	$tIPE2	= mssql_fetch_row($sIPE2);
	//echo"$tIPE2[0]";
	// get jumlah pegawai pkuwt dalam INDUSTRI PERTAMBANGAN & ENERGI I	060100600000, kode so: 060100600000, tetap: 5
	$sIPE3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('060100600000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
	$tIPE3	= mssql_fetch_row($sIPE3);
	//echo"$tIPE3[0]";
 ?>
  <td>1. SBU INDUSTRI PERTAMBANGAN &amp; ENERGI I</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	$SBUIPE1 = ($tIPE1[0]+$tIPE2[0]+$tIPE3[0]);
	echo $SBUIPE1;
  ?>
  </td>
  <td align="right"> 
   	<?=$tIPE1[0]?>
  </td>
  <td align="right">
   	<?=$tIPE2[0]?>
  </td>
  <td align="right">
   	<?=$tIPE3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
	// get jumlah pegawai tetap dalam SBU KELAUTAN, LINGKUNGAN & ENERGI	060100200000, kode so: 060100200000, tetap: 1
	$sKLE1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('060100200000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
	$tKLE1	= mssql_fetch_row($sKLE1);
	//echo"$tKLE1[0]";
	// get jumlah pegawai percobaan dalam SBU KELAUTAN, LINGKUNGAN & ENERGI	060100200000, kode so: 060100200000, tetap: 2
	$sKLE2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('060100200000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
	$tKLE2	= mssql_fetch_row($sKLE2);
	//echo"$tKLE2[0]";
	// get jumlah pegawai pkuwt dalam SBU KELAUTAN, LINGKUNGAN & ENERGI	060100200000, kode so: 060100200000, tetap: 5
	$sKLE3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('060100200000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
	$tKLE3	= mssql_fetch_row($sKLE3);
	//echo"$tKLE3[0]";
 ?>
  <td>2. SBU KELAUTAN, LINGKUNGAN &amp; ENERGI</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	$SSKLE = ($tKLE1[0]+$tKLE2[0]+$tKLE3[0]);
	echo $SSKLE;
  ?>
  </td>
  <td align="right"> 
   	<?=$tKLE1[0]?>
  </td>
  <td align="right">
   	<?=$tKLE2[0]?>
  </td>
  <td align="right">
   	<?=$tKLE3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
	// get jumlah pegawai tetap dalam SBU PERDAGANGAN DAN KEUANGAN 060100100000, kode so: 060100100000, tetap: 1
	$sSPK1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('060100100000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
	$tSPK1	= mssql_fetch_row($sSPK1);
	//echo"$tSPK1[0]";
	// get jumlah pegawai percobaan dalam SBU PERDAGANGAN DAN KEUANGAN 060100100000, kode so: 060100100000, tetap: 2
	$sSPK2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('060100100000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
	$tSPK2	= mssql_fetch_row($sSPK2);
	//echo"$tSPK2[0]";
	// get jumlah pegawai pkuwt dalam SBU PERDAGANGAN DAN KEUANGAN 060100100000, kode so: 060100100000, tetap: 5
	$sSPK3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('060100100000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
	$tSPK3	= mssql_fetch_row($sSPK3);
	//echo"$tSPK3[0]";
 ?>
  <td>3. SBU PERDAGANGAN DAN KEUANGAN</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	$SSPK = ($tSPK1[0]+$tSPK2[0]+$tSPK3[0]);
	echo $SSPK;
  ?>
  </td>
  <td align="right"> 
   	<?=$tSPK1[0]?>
  </td>
  <td align="right">
   	<?=$tSPK2[0]?>
  </td>
  <td align="right">
   	<?=$tSPK3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
  <td align="center"><b><i>Sub Total</i></b></td>
  <td>&nbsp;</td>
  <td align="right">
  <b>
  <?
  	echo ($SSPK+$SSKLE+$SBUIPE1);
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
  	echo ($tIPE1[0]+$tKLE1[0]+$tSPK1[0]);
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
  	echo ($tIPE2[0]+$tKLE2[0]+$tSPK2[0]);
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
  	echo ($tIPE3[0]+$tKLE3[0]+$tSPK3[0]);
  ?>
  </b>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr bgcolor="#CCCCCC">
  <td><b>TOTAL SBU</b></td>
  <td>&nbsp;</td>
  <td align="right">
  <b>
  <?
  // total SBU
  //echo ($SSPK+$SSKLE+$SBUIPE1+$SSBUPE1+$SSPE2+$SSPPIDN);
  //$total_sbu = ($SSPK+$SSKLE+$SBUIPE1+$SSBUPE1+$SSPE2+$SSPPIDN);
  $total_sbu = $SSBUPE1+$SSPE2+$SSPPIDN+$SSPK+$SSKLE+$SBUIPE1;
  echo $total_sbu;
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
  // total pegawai tetap SBU
  //echo ($tIPE1[0]+$tKLE1[0]+$tSPK1[0]+$tsbupe1[0]+$tsbupe21[0]+$tppidn1[0]);
  $total_sbu_tetap = ($tIPE1[0]+$tKLE1[0]+$tSPK1[0]+$tsbupe1[0]+$tsbupe21[0]+$tppidn1[0]);
  echo $total_sbu_tetap;
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
  // total pegawai percobaan SBU
  //echo ($tIPE2[0]+$tKLE2[0]+$tSPK2[0]+$tsbupe2[0]+$tsbupe2[0]+$tppidn2[0]);
  $total_sbu_percobaan = ($tIPE2[0]+$tKLE2[0]+$tSPK2[0]+$tsbupe2[0]+$tsbupe22[0]+$tppidn2[0]);
  echo $total_sbu_percobaan;
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
  // total pegawai pkuwt SBU
  //echo ($tIPE3[0]+$tKLE3[0]+$tSPK3[0]+$tsbupe3[0]+$tsbupe3[0]+$tppidn3[0]);
  $total_sbu_pkuwt = ($tIPE3[0]+$tKLE3[0]+$tSPK3[0]+$tsbupe3[0]+$tsbupe33[0]+$tppidn3[0]);
  echo $total_sbu_pkuwt;
  ?>  
  </b>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
 </tr>
 <tr bgcolor="#CCCCCC">
  <td><b>CABANG</b></td>
  <td></td>
  <td align="center">&nbsp;</td>
  <td align="center">&nbsp;</td>
  <td align="center">&nbsp;</td>
  <td align="center">&nbsp;</td>
  <td align="center">&nbsp;</td>
 </tr>
 <tr>
 <?
	// get jumlah pegawai tetap dalam CABANG JAKARTA, kode so: 010001400000, tetap: 1
	$sJKT1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001400000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
	$tJKT1	= mssql_fetch_row($sJKT1);
	//echo"$tJKT1[0]";
	// get jumlah pegawai percobaan dalam CABANG JAKARTA, kode so: 010001400000, tetap: 2
	$sJKT2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001400000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
	$tJKT2	= mssql_fetch_row($sJKT2);
	//echo"$tJKT2[0]";
	// get jumlah pegawai pkuwt dalam CABANG JAKARTA, kode so: 010001400000, tetap: 5
	$sJKT3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001400000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
	$tJKT3	= mssql_fetch_row($sJKT3);
	//echo"$tJKT3[0]";
 ?>
  <td>1. SIJAK</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	$SSIJAK = ($tJKT1[0]+$tJKT2[0]+$tJKT3[0]);
	echo $SSIJAK;
  ?>
  </td>
  <td align="right"> 
   	<?=$tJKT1[0]?>
  </td>
  <td align="right">
   	<?=$tJKT2[0]?>
  </td>
  <td align="right">
   	<?=$tJKT3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
	// get jumlah pegawai tetap dalam CABANG BALIKPAPAN, kode so: 010001600000, tetap: 1
	$sBPP1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001600000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
	$tBPP1	= mssql_fetch_row($sBPP1);
	//echo"$tBPP1[0]";
	// get jumlah pegawai percobaan dalam CABANG BALIKPAPAN, kode so: 010001600000, tetap: 2
	$sBPP2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001600000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
	$tBPP2	= mssql_fetch_row($sBPP2);
	//echo"$tBPP2[0]";
	// get jumlah pegawai pkuwt dalam CABANG BALIKPAPAN, kode so: 010001600000, tetap: 5
	$sBPP3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001600000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
	$tBPP3	= mssql_fetch_row($sBPP3);
	//echo"$tBPP3[0]";
 ?>
  <td>2. SIBPP</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  $SSIBPP = ($tBPP1[0]+$tBPP2[0]+$tBPP3[0]);
  echo $SSIBPP;
  ?>
  </td>
  <td align="right"> 
   	<?=$tBPP1[0]?>
  </td>
  <td align="right">
   	<?=$tBPP2[0]?>
  </td>
  <td align="right">
   	<?=$tBPP3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
	// get jumlah pegawai tetap dalam CABANG MEDAN, kode so: 010001500000, tetap: 1
	$sMDN1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001500000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
	$tMDN1	= mssql_fetch_row($sMDN1);
	//echo"$tMDN1[0]";
	// get jumlah pegawai percobaan dalam CABANG MEDAN, kode so: 010001600000, tetap: 2
	$sMDN2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001500000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
	$tMDN2	= mssql_fetch_row($sMDN2);
	//echo"$tMDN2[0]";
	// get jumlah pegawai pkuwt dalam CABANG MEDAN, kode so: 010001600000, tetap: 5
	$sMDN3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001500000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
	$tMDN3	= mssql_fetch_row($sMDN3);
	///echo"$tMDN3[0]";
 ?>
  <td>3. SIMED</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	$SSIMED = ($tMDN1[0]+$tMDN2[0]+$tMDN3[0]);
	echo $SSIMED;
  ?>
  </td>
  <td align="right"> 
   	<?=$tMDN1[0]?>
  </td>
  <td align="right">
   	<?=$tMDN2[0]?>
  </td>
  <td align="right">
   	<?=$tMDN3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
    	// get jumlah pegawai tetap dalam CABANG PEKANBARU, kode so: 010001900000, tetap: 1
		$sPKU1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001900000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
		$tPKU1	= mssql_fetch_row($sPKU1);
		//echo"$tPKU1[0]";
    	// get jumlah pegawai percobaan dalam CABANG PEKANBARU, kode so: 010001900000, tetap: 2
		$sPKU2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001900000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
		$tPKU2	= mssql_fetch_row($sPKU2);
		//echo"$tPKU2[0]";
    	// get jumlah pegawai pkuwt dalam CABANG PEKANBARU, kode so: 010001900000, tetap: 5
		$sPKU3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001900000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
		$tPKU3	= mssql_fetch_row($sPKU3);
		//echo"$tPKU3[0]";
 
 ?>
  <td>4. SIPKU</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	$SSPKU = ($tPKU1[0]+$tPKU2[0]+$tPKU3[0]);
	echo $SSPKU;
  ?>
  </td>
  <td align="right"> 
   	<?=$tPKU1[0]?>
  </td>
  <td align="right">
   	<?=$tPKU2[0]?>
  </td>
  <td align="right">
   	<?=$tPKU3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
	// get jumlah pegawai tetap dalam CABANG SURABAYA, kode so: 010001700000, tetap: 1
	$sSUB1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001700000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
	$tSUB1	= mssql_fetch_row($sSUB1);
	//echo"$tSUB1[0]";
	// get jumlah pegawai percobaan dalam CABANG SURABAYA, kode so: 010001700000, tetap: 2
	$sSUB2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001700000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
	$tSUB2	= mssql_fetch_row($sSUB2);
	//echo"$tSUB2[0]";
	// get jumlah pegawai pkuwt dalam CABANG SURABAYA, kode so: 010001700000, tetap: 5
	$sSUB3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001700000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
	$tSUB3	= mssql_fetch_row($sSUB3);
	//echo"$tSUB3[0]";
 ?>
  <td>5. SISUB</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	$SSISUB = ($tSUB1[0]+$tSUB2[0]+$tSUB3[0]);
	echo $SSISUB;
  ?>
  </td>
  <td align="right"> 
   	<?=$tSUB1[0]?>
  </td>
  <td align="right">
   	<?=$tSUB2[0]?>
  </td>
  <td align="right">
   	<?=$tSUB3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
	// get jumlah pegawai tetap dalam CABANG PALEMBANG, kode so: 010001300000, tetap: 1
	$sPAL1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001300000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
	$tPAL1	= mssql_fetch_row($sPAL1);
	//echo"$tPAL1[0]";
	// get jumlah pegawai percobaan dalam CABANG PALEMBANG, kode so: 010001300000, tetap: 2
	$sPAL2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001300000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
	$tPAL2	= mssql_fetch_row($sPAL2);
	//echo"$tPAL2[0]";
	// get jumlah pegawai pkuwt dalam CABANG PALEMBANG, kode so: 010001300000, tetap: 5
	$sPAL3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('010001300000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
	$tPAL3	= mssql_fetch_row($sPAL3);
	//echo"$tPAL3[0]";
 ?>
  <td>6. SIPAL</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	$SSIPAL = ($tPAL1[0]+$tPAL2[0]+$tPAL3[0]);
	echo $SSIPAL;
  ?>
  </td>
  <td align="right"> 
   	<?=$tPAL1[0]?>
  </td>
  <td align="right">
   	<?=$tPAL2[0]?>
  </td>
  <td align="right">
   	<?=$tPAL3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr>
 <?
	// get jumlah pegawai tetap dalam CABANG MAKASSAR, kode so: 060100500000, tetap: 1
	$sMKR1	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('060100500000',0,7)."' AND (stat_kar2='1') AND Jenis NOT IN ('U','H')",$conn);
	$tMKR1	= mssql_fetch_row($sMKR1);
	//echo"$tMKR1[0]";
	// get jumlah pegawai percobaan dalam CABANG MAKASSAR, kode so: 060100500000, tetap: 2
	$sMKR2	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('060100500000',0,7)."' AND (stat_kar2='2') AND Jenis NOT IN ('U','H')",$conn);
	$tMKR2	= mssql_fetch_row($sMKR2);
	//echo"$tMKR2[0]";
	// get jumlah pegawai pkuwt dalam CABANG MAKASSAR, kode so: 060100500000, tetap: 5
	$sMKR3	= mssql_query("SELECT count(*) FROM VLatestKarir WHERE substring(kode_so2,1,7)='".substr('060100500000',0,7)."' AND stat_kar2='5' AND Jenis NOT IN ('U','H')",$conn);
	$tMKR3	= mssql_fetch_row($sMKR3);
	//echo"$tMKR3[0]";
 ?>
  <td>7. SIMKR</td>
  <td>&nbsp;</td>
  <td align="right">
  <?
  	$SSIMKR = ($tMKR1[0]+$tMKR2[0]+$tMKR3[0]);
	echo $SSIMKR;
  ?>
  </td>
  <td align="right"> 
   	<?=$tMKR1[0]?>
  </td>
  <td align="right">
   	<?=$tMKR2[0]?>
  </td>
  <td align="right">
   	<?=$tMKR3[0]?>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr bgcolor="#CCCCCC">
  <td><b>TOTAL PEGAWAI CABANG</b></td>
  <td>&nbsp;</td>
  <td align="right">
  <b>
  <?
  // total pegawai CABANG
  //echo ($SSIJAK+$SSIBPP+$SSIMED+$SSPKU+$SSISUB+$SSIPAL+$SSIMKR);
  $total_cabang =  ($SSIJAK+$SSIBPP+$SSIMED+$SSPKU+$SSISUB+$SSIPAL+$SSIMKR);
  echo $total_cabang;
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
  // total pegawai tetap SBU
  //echo ($tIPE1[0]+$tKLE1[0]+$tSPK1[0]+$tsbupe1[0]+$tsbupe21[0]+$tppidn1[0]);
  $total_cabang_tetap = ($tJKT1[0]+$tBPP1[0]+$tMDN1[0]+$tPKU1[0]+$tSUB1[0]+$tPAL1[0]+$tMKR1[0]);
  echo $total_cabang_tetap;
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
  // total pegawai percobaan SBU
  //echo ($tIPE2[0]+$tKLE2[0]+$tSPK2[0]+$tsbupe2[0]+$tsbupe2[0]+$tppidn2[0]);
  $total_cabang_percobaan = ($tJKT2[0]+$tBPP2[0]+$tMDN2[0]+$tPKU2[0]+$tSUB2[0]+$tPAL2[0]+$tMKR2[0]);
  echo $total_cabang_percobaan;
  ?>
  </b>
  </td>
  <td align="right">
  <b>
  <?
  // total pegawai pkuwt SBU
  //echo ($tIPE3[0]+$tKLE3[0]+$tSPK3[0]+$tsbupe3[0]+$tsbupe3[0]+$tppidn3[0]);
  $total_cabang_pkuwt = ($tJKT3[0]+$tBPP3[0]+$tMDN3[0]+$tPKU3[0]+$tSUB3[0]+$tPAL3[0]+$tMKR3[0]);
  echo $total_cabang_pkuwt;
  ?>  
  </b>
  </td>
  <td>&nbsp;</td>
 </tr>
 <tr bgcolor="#CCCCCC">
  <td><b><i>GRAND TOTAL</i></b></td>
  <td>&nbsp;</td>
  <td align="right"><b><?=($total_pusat+$total_sbu+$total_cabang)?></b></td>
  <td align="right"><b><?=($total_pusat_tetap+$total_sbu_tetap+$total_cabang_tetap)?></b></td>
  <td align="right"><b><?=($total_pusat_percobaan+$total_sbu_percobaan+$total_cabang_percobaan)?></b></td>
  <td align="right"><b><?=($total_pusat_pkuwt+$total_sbu_pkuwt+$total_cabang_pkuwt)?></b></td>
  <td>&nbsp;</td>
 </tr>
</table>
<?
//*///
if($HTTP_GET_VARS['excel'] == "yes"){
	header('Content-type: application/vnd.ms-excel');
	header("Content-Disposition: attachment; filename=StatistikKepegawaianPTSurveyorIndonesia.xls");
	header("Pragma: no-cache");
	header("Expires: 0");
	}
else{

}
//	*/
?>
</body>
</html>
